<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/inc/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>资源信息添加</title>
<%@ include file="/inc/head.jsp"%>
</head>
<script type="text/javascript">
	var submitForm = function($dialog, $grid, $pjq) {
		if ($('form').form('validate')) {
			var url;
			if ($(':input[name="id"]').val().length > 0) {
				url = sy.contextPath + '/sys/resource/update';
			} else {
				url = sy.contextPath + '/sys/resource/create';
			}
			$.post(url, sy.serializeObject($('form')), function(result) {
				if (result.success) {
					$grid.datagrid('load');
					$dialog.dialog('destroy');
				} else {
					$pjq.messager.alert('提示', result.msg, 'error');
				}
			}, 'json');
		}
	};
	var showIcons = function() {
		var dialog = parent.sy.modalDialog({
			title : '浏览小图标',
			url : sy.contextPath + '/sys/resource/showIcons',
			buttons : [ {
				text : '确定',
				handler : function() {
					dialog.find('iframe').get(0).contentWindow.selectIcon(
							dialog, $('#iconCls'));
				}
			} ]
		});
	};
</script>
<body>
	<form:form method="post" commandName="m" cssClass="form">
		<form:hidden path="id" />
		<form:hidden path="parentId" />
		<form:hidden path="parentIds" />
		<form:hidden path="weight" />
		<fieldset>
			<legend>资源基本信息</legend>
			<table class="table" style="width: 100%;">
				<tr>
					<th>名称</th>
					<td><form:input path="name" cssClass="easyui-textbox"
							data-options="required:true" /></td>
				</tr>
				<tr>
					<th>父节点</th>
					<td><input class="easyui-combotree" value=""
						data-options="url:'${ctx}/sys/resource/combotree',method:'post'"
						style="width: 300px;"></td>
				</tr>
				<tr>
					<th>资源标识</th>
					<td><form:input path="identity" cssClass="easyui-textbox" /></td>
				</tr>
				<tr>
					<th>URL地址</th>
					<td><form:input path="url" cssClass="easyui-textbox" /></td>
				</tr>
				<tr>
					<th>图标</th>
					<td><form:input path="icon" readonly="true"
							cssStyle="padding-left: 18px; width: 134px;"
							cssClass="easyui-textbox" /> <img class="iconImg ext-icon-zoom"
						onclick="showIcons();" title="浏览图标" />&nbsp;<img
						class="iconImg ext-icon-cross"
						onclick="$('#iconCls').val('');$('#iconCls').attr('class','');"
						title="清空" /></td>
				</tr>
				<tr>
					<th>权重</th>
					<td><form:input path="weight" cssClass="easyui-numberbox" /></td>
				</tr>
				<tr>
					<th>是否显示</th>
					<td><form:radiobuttons path="show" items="${booleanList}"
							itemLabel="info" itemValue="value" /></td>
				</tr>
			</table>
		</fieldset>
	</form:form>
</body>
</html>